import java.util.Scanner;

//题目：求1+2!+3!+...+20!的和
public class Test21 {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.println("请输入一个数:");
        int numb = console.nextInt();
        long sum = 0;
        for (int i = 1; i <= numb; i++) {
            sum += calculate(i);
        }
        System.out.print(sum);
    }

    public static int calculate(int n) {
        if (n == 1) {
            return 1;
        }
        return n * calculate(n - 1);
    }
}
